/*******************************************************************************																	
	DESCRIPTION: 	This do file cleans the predictions coming out of R, obtains the ensemble
					model, performs the last calibration step and saves the final dataset.
					
					This is done for individuals from fixed year X 
					with model used to generate predictions trained on year Y.
					
*******************************************************************************/

clear all
global id_code 003

* Import the cleaning program:
do  "${code}/Data Management/003_0_CleaningPredictions_program.do"

*******************************************************************************
** Baseline, 2006  **
*******************************************************************************

* Set outcomes:
global outcomes emplAft6M_0M_In emplAft6M_6M_In emplAft6M_12M_In

* Set models and year span:
global models Full
			
global yearSpan 1992/2016

global yearSpan_indiv 1992/2016

foreach model in $models  {
		
		foreach year of numlist $yearSpan {
			
			foreach year_indiv of numlist $yearSpan_indiv {
					
					di "Cleaning `model' `year' Model, `year_indiv' sample"
					cleanpred, model(`model') year(`year') outcomes(${outcomes}) ///
						model_sample(`model') year_sample(`year_indiv') outcomes_sample(${outcomes}) ///
						name("Individuals_TrainedOn`year'modelIndividuals_`model'")
					
			}
					
		}
}
